<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue-2.4.0.js"></script>
    <script src="lib/moment.js"></script>
</head>
<body>
<div id="app">
    <div>{{date|format('YYYY-MM-DD HH:mm:ss')}}</div>
</div>
<script>
    Vue.filter('format',function (val,arg) {
        console.log(val)
        console.log(arg)
        // if (arg=='yyyy-MM-dd'){
        //     var ret=''
        //     ret+=(val.getFullYear())+'-'+(val.getMonth()+1)+'-'+(val.getDate())
        //     return ret
        // }
        return moment(val).format(arg)
    })
    var vm=new Vue({
        el:'#app',
        data:{
            date:new Date()
        },
        methods:{

        }
    })
</script>
</body>
</html>